//
//  JddNavigationBar.m
//  PlayBall
//
//  Created by Edward Zhang on 12-5-4.
//  Copyright (c) 2012年 __MyCompanyName__. All rights reserved.
//

#import "JddNavigationBar.h"
#import <QuartzCore/QuartzCore.h>

@implementation JddNavigationBar

- (id)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        // Initialization code
    }
    return self;
}


// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect
{
    [super drawRect:rect];
    UIImage *image = (UIImage *)[UIColor blueColor];
    [image drawInRect:CGRectMake(0, 0, self.frame.size.width, self.frame.size.height)];
    
}


@end


//--------------
@implementation JddUIBarButtonItem

-(id) initWithImageForButton:(UIImage *)barImage withTitle:(NSString *)title withBlock:(void(^)())btnAction
{
    barButtonAcionBlock = btnAction;
    
    UIButton *barButton = [UIButton buttonWithType:UIButtonTypeCustom];
    if(barImage)
    {
        [barButton setImage:barImage forState:UIControlStateNormal];
    }
    if(title)
    {
        [barButton setTitle:title forState:UIControlStateNormal];
        [barButton setTitleColor:[UIColor redColor] forState:UIControlStateNormal];
    }
    barButton.frame = CGRectMake(0, 0, 50,30);
    
    [barButton addTarget:self action:@selector(blockBtnAction) forControlEvents:UIControlEventTouchUpInside];
    return [self initWithCustomView:barButton];
}

-(void) blockBtnAction
{
    barButtonAcionBlock();
}












@end